<template>
	<view style="width:100%;overflow: hidden;padding:0;">
		<div class="bg-gray -body" style="top:245px;">
			<div class="-page-block" style="margin-top: 10px;">
				<div class="title">我的订单</div>
				<div class="d-flex a-center j-center" style="margin:25px 0;">
					<div class="f1 text-center d-flex a-center j-center" @tap="order0()">
						<div class="-icon -icon-order-done"></div>
						<div class="text-dark" style="margin-left:5px;font-size:1rem;">借阅记录</div>
						<!-- 已借，已还记录 -->
					</div>
					<div class="f1 text-center d-flex a-center j-center" style="border-left:solid 1px #efefef;"
						@tap="order1()">
						<div class="-icon -icon-order-all"></div>
						<div class="text-dark" style="margin-left:5px;font-size:1rem;">购买记录</div>
						<!-- 购买记录 -->
					</div>
				</div>
			</div>
		</div>

		<!-- 底部菜单 -->
		<globalMenu ref="gm" @onLoginStatusChange="onLSC"></globalMenu>
	</view>
</template>

<script>
	import globalMenu from '@/components/global-menu.vue'
	import com from '../common/index.js'
	export default {
		components: {
			globalMenu
		},
		data() {
			return {
				logined: false
			}
		},
		onShow() {
			//更新用户信息
			this.$refs.gm.userDataUpdate()
		},
		methods: {
			//当用户登录状态改变
			onLSC(e) {
				//console.log('lsc:', e)
				this.logined = e ? true : false
			},
			// 借还记录
			order0() {
				if (this.logined !== true) {
					uni.showToast({
						title: '请先登录',
						icon: 'error'
					})
					return
				}
				com.go('order0')
			},
			// 购买记录
			order1() {
				if (this.logined !== true) {
					uni.showToast({
						title: '请先登录',
						icon: 'error'
					})
					return
				}
				console.log('购买记录')
				com.go('order1')
			},
		},
	}
</script>

<style>
	.-body {
		height: calc(100vh - 260px);
		position: fixed;
		top: 265px;
		z-index: 22;
		left: 0;
		width: 100%;
	}
</style>